package wf.source.hrm.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import wf.source.hrm.service.ISmsCodeService;
import wf.source.hrm.util.AjaxResult;

import java.util.Map;

/**
 * 短信验证码
 */
@RestController
@RequestMapping("/sendSmsCode")
public class SmsCodeController {
    @Autowired
    private ISmsCodeService smsCodeService;

    @PostMapping//前端提交的参数 后端由map接收 mobile imageCode imageCodeKey
    public AjaxResult sendSmsCode(@RequestBody Map<String,Object> params){
        try{
            return smsCodeService.sendSmsCode(params);
        }catch (Exception e){
            e.printStackTrace();
            return AjaxResult.me().setSuccess(false).setMessage("短信发送失败!"+e.getMessage());
        }
    }
}
